package ooday04;

public class Test {
    public static void main(String[] args) {
        Animal[] animals = new Animal[5];
        animals[0] = new Dog("小黑",1,"黑");
        animals[1] = new Dog("小白",1,"白");
        animals[2] = new Chick("花花",2,"黄");
        animals[3] = new Chick("蔡徐坤",2,"黑白");
        animals[4] = new Fish("泡泡",3,"彩");
        for (int i = 0; i < animals.length; i++) {
            System.out.println(animals[i].name);
            animals[i].eat();
            animals[i].drink();
            if (animals[i] instanceof Dog){
                Dog dog = (Dog) animals[i];
                dog.lookHome();
            }
            if (animals[i] instanceof Chick){
                Chick chick = (Chick) animals[i];
                chick.sayEggs();
            }
            if (animals[i] instanceof Swim){
                Swim s = (Swim) animals[i];
                s.swim();
            }
        }



























    }
}
